<?php
function getPage($data, $limit)
{
    import('ORG.Util.Page'); // 导入分页类
    $Page = new Page(count($data), $limit);
    $show = $Page->show(); // 分页显示输出
    $result['count'] = count($data);
    $result['totalPages'] = $Page->totalPages;
    $result['totalRows'] = $Page->totalRows;
    $result['nowPage'] = $Page->nowPage;
    $result['html'] = $show;
    $result['data'] = array_slice($data, $Page->firstRow, $limit);
    return $result;
}

function  getSchoolType($type)
{

    if ($type == 1) {
        return '本科';
    }
    if ($type == 2) {
        return '硕士';

    }
    if ($type == 3) {
        return '博士';
    }
    if ($type == 4) {
        return '专科或高职';
    }
    if ($type == 5) {
        return '高中';
    }
    if ($type == 6) {
        return '中专或技校';
    }
    if ($type == 7) {
        return '初中';
    }
}
//发送系统信息

function sendInfo($mid, $tpl, $uid, $config = array())
{
    $user = D('User')->getUserInfo($mid);
    $config['name'] = $user['uname'];
    $config['space_url'] = $user['space_url'];
    $config['face'] = $user['avatar_tiny'];
    if (!isset($config['source_url']))
        $config['source_url'] = U('friend/Index/friend_applylist');
    $from = '好友';
    D('Notify')->sendNotify($uid, $tpl, $config, $from);
}
function checknull($new, $old)
{
    if ($new == null || $new == '0' || $new == 0) {
        return $old;
    } else {
        return $new;
    }

}
